home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 235 / Issue 235 - September 2007 - DPCS0907DVD.ISO / Extras / NetObjects Fusion / NOF10.exe / data1.cab / Style_Template_English / template / scripts.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2007-04-11  |  2.4 KB  |  111 lines

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2.  
  3.  
  4. <xsl:stylesheet  xmlns:xsl= "http://www.w3.org/1999/XSL/Transform"
  5.                  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  6.                  xmlns:nof="http://netobjects.com/nof"
  7.                  version="1.0">
  8.   
  9. <xsl:output method="html"/>
  10. <xsl:output cdata-section-elements="SCRIPT"/>
  11. <xsl:strip-space elements="*"/>  
  12.  
  13. <msxsl:script implements-prefix="nof">              
  14. <![CDATA[  
  15. function getHexDigit(decimal) {            
  16.    var hexArray = Array("A", "B", "C", "D", "E", "F");
  17.    var hexVal = parseInt(0 + decimal, 10);
  18.   
  19.    if ((hexVal) > 15) {
  20.      return null;
  21.    }
  22.    else {
  23.       hexVal = hexVal < 10 ? hexVal : hexArray[hexVal-10];
  24.    }
  25.    return hexVal;
  26. }
  27.  
  28. function decToHex(decimal) {
  29.   if (decimal.length == 1)
  30.     return "#000000";
  31.     
  32.    var temp = parseInt(decimal,10);    
  33.    if (isNaN(temp)) { 
  34.      return  "#000000";
  35.    }
  36.   
  37.    var hex = "";
  38.    while (temp > 15) {
  39.       remainder = temp % 16;
  40.       hex = getHexDigit(remainder) + "" + hex
  41.       temp = parseInt(temp / 16);
  42.    }
  43.    if (temp >= 0) {
  44.       hex =  getHexDigit(temp) + "" + hex
  45.    }
  46.    else {    
  47.       return 0;
  48.    }
  49.    
  50.    size  = hex.length;
  51.    zeros = "";
  52.    if ( size != 6 ) 
  53.       for ( j=0; j < 6 - size; j++ ) {
  54.       zeros = zeros + "0";
  55.     }
  56.    
  57.    //zeros + hex is the complement color of the one show by Fusion
  58.    var hexa = zeros + hex;
  59.    return ("#"   + hexa.substring(4, 6    ) + hexa.substring(2, 4) + hexa.substring(0, 2));
  60. }  
  61.  
  62. function parseHeight(value) {
  63.   return value.substring(value.indexOf("-") + 1, value.length);
  64. }
  65.  
  66. function parseFontStyle(value) {
  67.   var value = "";
  68.   if (arguments[0] != 0) //italic
  69.     value =  "italic";
  70.   
  71.   return value;
  72. }
  73.  
  74. /*
  75. function parseTextDecoration() {
  76.   var value = "";                
  77.   if (arguments[0] != 0) //strikeout
  78.     value = "line-through";
  79.   if (arguments[1] != 0)
  80.     value += "underline"; //underline        
  81.   
  82.   return value;
  83. }*/
  84.   
  85.  
  86. function getFontSize(value) {    
  87.   value = value + "";
  88.   
  89.   if (value.length == 0)
  90.     return "";
  91.  
  92.   value = value.substring(value.indexOf("-") + 1, value.length);
  93.     
  94.   return value;  
  95. }
  96.  
  97. function getHorizAndVert (value) {    
  98.   var hAlign = "left";
  99.   
  100.   if (value == 64)
  101.    hAlign = "center"
  102.   else if (value == 128)
  103.     hAlign = "right";
  104.     
  105.   return hAlign;// + "; vertical-align:" + vAlign + "; white-space:nowrap;"; 
  106. }
  107.  
  108. ]]>
  109. </msxsl:script>
  110.  
  111. </xsl:stylesheet>